package com.tongbo.mobilesafe.receiver;

import com.tongbo.mobilesafe.ui.LostProtectedActivity;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class CallPhoneReceiver extends BroadcastReceiver{

	@Override
	public void onReceive(Context context, Intent intent) {
		String number = getResultData();
		if("20122012".equals(number)){
			Intent lostIntent = new Intent(context, LostProtectedActivity.class);
			lostIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			//指定要激活的activity在自己的任务栈里面运行
			context.startActivity(lostIntent);
			
			//终止掉这个电话,不能通过abortBroadcast();,要通过清空里面的数据实现终止拨打电话的广播
			setResultData(null);
		}
	}
}
